<!DOCTYPE html>
<!-- 网页使用的语言 -->
<html lang="zh-CN">
<head>
    <!-- 指定字符集 -->
    <meta charset="utf-8">
    <!-- 使用Edge最新的浏览器的渲染方式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- viewport视口：网页可以根据设置的宽度自动进行适配，在浏览器的内部虚拟一个容器，容器的宽度与设备的宽度相同。
    width: 默认宽度与设备的宽度相同
    initial-scale: 初始的缩放比，为1:1 -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>用户信息管理系统</title>

    <!-- 1. 导入CSS的全局样式 -->
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <!-- 2. jQuery导入，建议使用1.9以上的版本 -->
    <script src="/static/js/jquery-2.1.0.min.js"></script>
    <!-- 3. 导入bootstrap的js文件 -->
    <script src="/static/js/bootstrap.min.js"></script>
    <style type="text/css">
        td, th {
            text-align: center;
        }
        #tuichudenglu{
              position: absolute;
              top: 100px;
              left: 1200px;
        }
        #anniu,#sousuo{
            position: relative;
            top: -5px;
        }

    </style>
    <script>
        $(function () {
            $("#anniu").click(function () {
                var content = $("#sousuo").val()
                {#alert(content)#}

                var url = "/booklist?content="+encodeURIComponent(content)
                window.location.href = url
            })
            $("#tuichudenglu").click(function () {
                window.location.href = "/login"
            })
        })
    </script>
</head>
<body>
<div class="container">
    <ul class="nav nav-tabs">
      <li role="presentation" class="active"><a href="/booklist/">图书列表</a></li>
        <li role="presentation"><a href="/presslist/">出版社列表</a></li>
      <li role="presentation"><a href="/booktypelist/">图书类型</a></li>
    </ul>

    <h3 style="text-align: center">图书信息列表</h3>
        <div>
                <input type="text" id="sousuo" value="{{ content }}" placeholder="请输入搜索内容" name="content" aria-label="搜索内容">
                <button type="button" id="anniu" class="glyphicon glyphicon-search" >搜索</button>
                <button type="button" id="tuichudenglu" class="glyphicon glyphicon-log-in"> 退出登录</button>
        </div>
    <table border="1" class="table table-bordered table-hover">
        <tr class="success">
            <th>编号</th>
            <th>图书名称</th>
            <th>图书价格</th>
            <th>图书作者</th>
            <th>图书图片</th>
            <th>图书出版社</th>
            <th>操作</th>
        </tr>

        {% for book in booklist %}
        <tr>
            <td>{{ forloop.counter }}</td>
            <td>{{ book.bookname }}</td>
            <td>{{ book.bookprice }}</td>
            <td>{{ book.bookauther }}</td>
            <td><img src="{{ book.bookimg }}" style="width: 100px;height: 100px"></td>
            <td>{{ book.press.pressname}}</td>
            <td><a class="btn btn-default btn-sm" href="/bookupdate?id={{ book.id }}">修改</a>&nbsp;
                <button class="btn btn-default btn-sm" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#delModal{{ book.id }}">删除</button></td>
                    <div class="modal fade" id="delModal{{ book.id }}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                  <div class="modal-dialog" role="document">
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">图书管理系统</h4>
                      </div>
                      <div class="modal-body">
                        您确定要删除吗？
                      </div>
                      <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary" onclick=window.location.href="/bookdelete?id={{ book.id }}">确定删除</button>
                      </div>
                    </div>
                  </div>
                </div>

        </tr>
        {% endfor %}




        <tr>
            <td colspan="8" align="center"><a class="btn btn-primary" href="/bookadd/">添加图书</a></td>
        </tr>
    </table>
</div>
</body>
</html>
